package com.szbmyoubao.app.view.dialog

import android.view.LayoutInflater
import androidx.fragment.app.FragmentActivity
import com.szbmyoubao.app.bean.response.TemplateItems
import com.ellecity06.common.base.BaseDialog
import com.ellecity06.common.ktx.load
import com.ellecity06.common.utils.logD
import com.ellecity06.cwhiskymall.databinding.DialogPreviewImageBinding

/**
 * @author zavier
 * @time 2025/3/10 17:00
 * @des
 */
class PreviewImageDialog(activity: FragmentActivity) : BaseDialog<DialogPreviewImageBinding>(activity) {

    override val dimAmount: Float
        get() = 0.5F
    override val widthP: Float
        get() = 1F


    override fun inflaterViewBinding(): DialogPreviewImageBinding {
        return DialogPreviewImageBinding.inflate(LayoutInflater.from(context))
    }

    override fun initialize() {
        binding.ivClose.setOnClickListener {
            dismiss()
        }
    }

    fun show(item: TemplateItems) {
        logD("${item}")
        binding.ivBg.load(binding.ivBg.context, item.templateUrl)
        binding.tvTitle.text = item.templateName
        show()
    }
}